<template>
  <div>
    <!-- 订单模块下属六个页面
    1.订单信息 2.超时订单 3.进出信息 4.订单评论 5.订单日志 6.物业流水(本页面) -->
    <div style="padding-bottom:5px">
      <el-button @click="showWindow">查询</el-button>
    </div>

    <el-table :data="page.records">
      <el-table-column
        label="订单编号"
        prop="orderInfoNum">
      </el-table-column>
      <el-table-column
        label="添加时间"
        prop="addTime">
      </el-table-column>
      <el-table-column
        label="流水金额"
        prop="moneyNum">
      </el-table-column>
      <el-table-column
        label="流水类型"
        prop="moneyType">
      </el-table-column>
    </el-table>

    <div style="padding-top:5px">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.current"
        :page-sizes="[3,5,7]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total">
      </el-pagination>
    </div>

    <el-dialog :visible.sync="window">
      <div style="padding-bottom:10px">
      <el-input placeholder="请输入订单编号" style="width:200px" v-model="moneySelect.orderInfoNum"></el-input>
      &nbsp;
      <el-select v-model="moneySelect.moneyType" placeholder="请选择流水类型">
        <el-option value="0" label="普通"></el-option>
        <el-option value="1" label="取消"></el-option>
        <el-option value="2" label="超时"></el-option>
      </el-select>
      </div>
      <div style="padding-bottom:10px">
      <el-date-picker v-model="moneySelect.startTime" value-format="yyyy-MM-dd HH:mm:ss"  type="datetime" placeholder="选择开始时间"></el-date-picker>
      &nbsp;
      <el-date-picker v-model="moneySelect.endTime" value-format="yyyy-MM-dd HH:mm:ss"  type="datetime" placeholder="选择结束时间"></el-date-picker>
      </div>
      <div style="padding-top:10px">
        <el-button @click="window=false">取 消</el-button>
        <el-button @click="showMoney">查 询</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'CertifiedMoney',
  data () {
    return {
      page: [],
      window: false,
      moneySelect: {
        startTime: "",
        endTime: "",
        orderInfoNum: "",
        moneyType: ""
      },
      moneySelected: {
        startTime: "",
        endTime: "",
        orderInfoNum: "",
        moneyType: ""
      }
    }
  },
  methods:{
    showWindow(){
      this.moneySelect.startTime = ""
      this.moneySelect.endTime = ""
      this.moneySelect.orderInfoNum = ""
      this.moneySelect.moneyType = ""
      this.window = true
    },
    showMoney(){
      this.moneySelected.startTime = this.moneySelect.startTime
      this.moneySelected.endTime = this.moneySelect.endTime
      this.moneySelected.orderInfoNum = this.moneySelect.orderInfoNum
      this.moneySelected.moneyType = this.moneySelect.moneyType
      this.showMoneyProper("","")
      this.window = false
    },
    showMoneyProper(pageNum,pageSize){
      this.$http.get("/order/centifiedMoney/findMoney.certified",{
        params:{
          pageNum:pageNum==""?1:pageNum,
          pageSize:pageSize==""?3:pageSize,
          startTime: this.moneySelected.startTime,
          endTime: this.moneySelected.endTime,
          moneyType: this.moneySelected.moneyType,
          orderInfoNum: this.moneySelected.orderInfoNum==""?null:this.moneySelected.orderInfoNum
        }
      }).then(resp=>{　
        if(resp.data.flag) this.page = resp.data.data
        else this.$alert(resp.data.message)　　
      })
    },
    handleSizeChange(val) {
      this.showCommentsProper("",val)
    },
    handleCurrentChange(val) {
      this.showCommentsProper(val,this.page.size)
    }
  },
  created(){
    this.showMoneyProper("","")
  }
}
</script>

<style>
</style>
